Improve pull-to-refresh usability in RefreshContainer - #18617
Conversation
|
You can test this PR using the following package version. |
|
|
|
||
| protected override void PointerPressed(PointerPressedEventArgs e) | ||
| { | ||
| if (Target != null && Target is Visual visual) //&& (e.Pointer.Type == PointerType.Touch || e.Pointer.Type == PointerType.Pen)) |
There was a problem hiding this comment.
Does this mean it works with a mouse? Or is this just for testing? I personally always found it weird some of the gesture recognisers are touch only.
There was a problem hiding this comment.
This is just a draft - please ignore - I needed the nuget package.
Its the pull2refresh PR including support for desktop apps (so yes, pull to refresh works on windows too)
There was a problem hiding this comment.
Sounds like a significant improvement over the existing pull gesture recogniser then, which is impossible to test with without a touch screen.
@cla-avalonia agree |
909d4f1 to
1243d1b
Compare
|
This is actually mainly the code of #17496, with one addition: Added a styled property "IsEnabledOnDesktop" that allows to optionally enable the pulltorefresh gesture on Desktop applications as well. |
|
You can test this PR using the following package version. |
|
Could you make your pr description more descriptive? Even if it's based on #17496 , it should still follow contribution guidelines. |
1243d1b to
c98aedf
Compare
|
Essentially, I
The third feature is important. It allows for
IsEnabledOnDesktop is a styled property Note that the propertyname is not of my concern. |
|
You can test this PR using the following package version. |
It would be best if you put this in the PR description and follow the section guides. |
|
Public API for review: namespace Avalonia.Input.GestureRecognizers
{
public class ScrollGestureRecognizer : GestureRecognizer
{
+ public static readonly DirectProperty<ScrollGestureRecognizer, Vector?> OffsetProperty;
+ public static readonly DirectProperty<ScrollGestureRecognizer, Size?> ExtentProperty;
+ public static readonly DirectProperty<ScrollGestureRecognizer, Size?> ViewportProperty;
+ public Size? Extent { get; private set; }
+ public Size? Offset { get; private set; }
+ public Size? Viewport { get; private set; }
}
}
namespace Avalonia.Controls
{
public class RefreshContainer : ContentControl
{
+ public static readonly StyledProperty<bool> IsEnabledOnDesktopProperty;
+ public bool IsEnabledOnDesktop { get; set; }
}
} |
|
I personally think it needs a better name than Alternatively, allowing customisation of the whitelist for what devices it accepts would also be better and more flexible. The current flag is kind of an all or touch only approach. |
|
Thanks for the great development. Releasing this PR will finally fix my gesture orchestrating issues in android! Hopefully it happens soon |
|
Notes from the API review: Remove the properties added to
|
c98aedf to
341f7e0
Compare
Sorry for the late reply, you're completely right. I'm not sure why |
|
You can test this PR using the following package version. |
|
You can test this PR using the following package version. |
3b6eb1a to
98844d6
Compare
|
I reworked the recognizer - at some points the pull to refresh gesture had no more effect. |
98844d6 to
c8ecdfe
Compare
Added gesture-recognizer for scroll-viewer to improve usability Added possibility to enable pulltorefresh on desktop too
c8ecdfe to
6e66a0d
Compare
|
You can test this PR using the following package version. |
|
You can test this PR using the following package version. |
|
You can test this PR using the following package version. |
|
Note: I've updated the tests to avoid reflection. |

What does the pull request do?
Pull to refresh is non-optimal in its current implementation:
What is the current behavior?
#15529 goes into great detail.
#17496 is the original pull request - but it seems to be abandoned.
So I:
What is the updated/expected behavior with this PR?
Pull to refresh works seemlessly for mobile and (optionally) also for desktop devices
How was the solution implemented (if it's not obvious)?
see #17496 for more details.
Checklist
I will consider submitting a PR to the documentation, if the desktop support property is accepted and the name is fixed.
Breaking changes
Obsoletions / Deprecations
Fixed issues
Fixes #15529